﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Chapter05.View
{
    /// <summary>
    /// BubbledLabelClickWindow.xaml 的交互逻辑
    /// </summary>
    public partial class TunneledLabelClickWindow : Window
    {
        public TunneledLabelClickWindow()
        {
            InitializeComponent();
        }

        private int eventCounter = 0;

        private void Something_KeyDwon(object sender, KeyEventArgs e)
        {
            eventCounter++;
            string message =
                "#" + eventCounter + "\r\n" +
                " 发送者：" + sender+ "\r\n" +
                " 源：" + e.Source + "\r\n" +
                " 原始源：" + e.OriginalSource + "\r\n" +
                " 事件：" + e.RoutedEvent;
            lstMessages.Items.Insert(0, message);
            e.Handled = !(bool)chkHandle.IsChecked;
        }

        private void cmdClear_Click(object sender, RoutedEventArgs e)
        {
            lstMessages.Items.Clear();
        }
    }
}
